https://leetcode.cn/problems/remove-duplicates-from-sorted-array/description/
26. 删除有序数组中的重复项

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        vector<int> v;
        int i=0,j=0;
        while(i<nums.size())
        {
            if(v.empty()||(nums[i]!=v[j]))
            {
                if(v.empty())
                {
                    v.push_back(nums[i]);
                }
                else
                {
                    v.push_back(nums[i]);
                    ++j;
                }
            }
            ++i;
        }
        nums.swap(v);
        return nums.size();
    }
};